package cn.iocoder.yudao.module.biz.dal.mysql.staffCertificate;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.staffCertificate.BizStaffCertificateDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.staffCertificate.vo.*;

/**
 * 证件管理 Mapper
 *
 * @author guangpu
 */
@Mapper
public interface BizStaffCertificateMapper extends BaseMapperX<BizStaffCertificateDO> {

    default PageResult<BizStaffCertificateDO> selectPage(BizStaffCertificatePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizStaffCertificateDO>()
                .eqIfPresent(BizStaffCertificateDO::getStaffId, reqVO.getStaffId())
                .eqIfPresent(BizStaffCertificateDO::getWorkTypeId, reqVO.getWorkTypeId())
                .eqIfPresent(BizStaffCertificateDO::getWorkId, reqVO.getWorkId())
                .eqIfPresent(BizStaffCertificateDO::getCertificateDept, reqVO.getCertificateDept())
                .betweenIfPresent(BizStaffCertificateDO::getFirstGetDate, reqVO.getBeginFirstGetDate(), reqVO.getEndFirstGetDate())
                .betweenIfPresent(BizStaffCertificateDO::getExpireDate, reqVO.getBeginExpireDate(), reqVO.getEndExpireDate())
                .eqIfPresent(BizStaffCertificateDO::getPhoto, reqVO.getPhoto())
                .betweenIfPresent(BizStaffCertificateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizStaffCertificateDO::getId));
    }

    default List<BizStaffCertificateDO> selectList(BizStaffCertificateExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizStaffCertificateDO>()
                .eqIfPresent(BizStaffCertificateDO::getStaffId, reqVO.getStaffId())
                .eqIfPresent(BizStaffCertificateDO::getWorkTypeId, reqVO.getWorkTypeId())
                .eqIfPresent(BizStaffCertificateDO::getWorkId, reqVO.getWorkId())
                .eqIfPresent(BizStaffCertificateDO::getCertificateDept, reqVO.getCertificateDept())
                .betweenIfPresent(BizStaffCertificateDO::getFirstGetDate, reqVO.getBeginFirstGetDate(), reqVO.getEndFirstGetDate())
                .betweenIfPresent(BizStaffCertificateDO::getExpireDate, reqVO.getBeginExpireDate(), reqVO.getEndExpireDate())
                .eqIfPresent(BizStaffCertificateDO::getPhoto, reqVO.getPhoto())
                .betweenIfPresent(BizStaffCertificateDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(BizStaffCertificateDO::getId));
    }
    Long getStaffCount();
}
